﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace Pattern.Model
{
    [Serializable]
    public class Sample : ICloneable
    {
        [XmlElement(ElementName = "FVal")]
        public double[] Features { get; set; }
        [XmlAttribute]
        public int Class { get; set; }


        public static Sample operator -(Sample left, Sample right)
        {

            var table = new double[left.Features.Length];
            for (int i = 0; i < table.Length; i++)
            {
                table[i] = left.Features[i] - right.Features[i];
            }
            return new Sample { Features = table, Class = left.Class };
        }

        public object Clone() { return new Sample { Class = Class, Features = (double[])Features.Clone() }; }
    }
}
